﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.IO;

using DreamCube.Foundation.Basic.Utility;
using DreamCube.Framework.Utilities.Office;

namespace Test
{
    class TestOffice
    {
        public static void Start()
        {
            //MyPdf.ConvertToSwf(@"D:\1.pdf", @"D:\1swf", "", true);
            //String filePath = Path.Combine( AppDomain.CurrentDomain.BaseDirectory ,"a.xls");
            //MyExcel excel = new MyExcel(filePath, "Sheet2");
            //Console.WriteLine(excel.GetCellValueEx("AP13"));
            //Console.WriteLine(excel.GetCellValueEx("BA12"));
            //Int32[] index = excel.ConvertCellNameToIndex("AP13");
            //Console.WriteLine(String.Format("{0},{1}", index[0], index[1]));
            //Console.WriteLine(excel.GetCellValue("zhuhaiqing"));
            //Console.WriteLine(excel.GetCellValueEx("B5"));
            //excel.Dispose();
            //DataTable data = MyExcel.GetSheetData(filePath);
            //Int32 i = 0;
            //MyExcel.TryKillAllExcelApp();
            //MyWord.TryKillAllWordApp();
            MyWord word = new MyWord(@"d:\1.docx");
            //word.SetBookMarkValue("lijian", @"D:\1.jpg", MyWord.InsertValueType.Image);
            //MyWord word = new MyWord(@"d:\2.docx");
            //MyWord.ConvertToPdf(@"d:\2.docx", @"d:\2.pdf");
            //MyWord.ConvertToSwf(@"d:\2.docx", @"d:\2.swf");
            //word.AppendWord(@"d:\1.doc", OfficeVersionType.Office2003);
            //word.AppendExcel(@"d:\1.xlsx");
            //word.AppendWord(@"d:\1.doc", OfficeVersionType.Office2003);
            //word.SetBookMarkValue("test", "<strong>ffffffff</strong>", MyWord.InsertValueType.RichText);
            //word.SaveAsPdf();
            word.RemoveAllEmptyPage();
            word.Save();
            word.Dispose();
            //MyWord word = new MyWord(@"d:\2.docx", OfficeVersionType.Office2007);
            //word.SetBookMarkValue("TABLE300_BTJH06", "<strong>844444444444444444444444</strong>", MyWord.InsertValueType.RichText);
            //word.Save();
            //word.Dispose();

            //MyExcel excel = new MyExcel(@"d:\1.xlsx", OfficeVersionType.Office2007);
            ////excel.SetCellDataOfCurrentSheet(20, 8, @"d:\2.png", 96, 32, MyExcel.InsertValueType.Image);
            ////Console.WriteLine(excel.GetCellIndexByName("AAA"));
            //Int32[] data = excel.ConvertCellAddressToIndex(excel.GetCellAddressByName("CCCCC"));
            //Console.WriteLine(data[0] + "," + data[1]);
            //List<String> nameList = excel.GetAllCellNames();
            //foreach (String item in nameList)
            //    Console.WriteLine(item);
            //excel.Save();
        }
    }
}
